local huangtian_other = fk.CreateSkill {

  name = "joyex__huangtian_other&",

  tags = {  },

}



huangtian_other:addEffect("active", {
  name = "joyex__huangtian_other&",
  anim_type = "support",
  prompt = "#joyex__huangtian-active",
  mute = true,
  can_use = function(self, player)
    if player.kingdom ~= "qun" then return false end
    local targetRecorded = player:getTableMark( "joyex__huangtian_sources-phase")
    return table.find(Fk:currentRoom().alive_players, function(p)
      return p ~= player and p:hasSkill("joyex__huangtian") and not table.contains(targetRecorded, p.id)
    end)
  end,
  card_num = 1,
  card_filter = function(self, player, to_select, selected)
    if #selected < 1 and Fk:currentRoom():getCardArea(to_select) ~= Card.PlayerEquip then
      local card = Fk:getCardById(to_select)
      return card.trueName == "jink" or card.suit == Card.Spade or card.trueName == "lightning"
    end
  end,
  target_num = 1,
  target_filter = function(self, player, to_select, selected)
    if #selected == 0 and to_select ~= player.id and Fk:currentRoom():getPlayerById(to_select):hasSkill("joyex__huangtian") then
      local targetRecorded = player:getMark("joyex__huangtian_sources-phase")
      return type(targetRecorded) ~= "table" or not table.contains(targetRecorded, to_select)
    end
  end,
  on_use = function(self, room, effect)
    local player = effect.from
    local target = effect.tos[1]
    room:notifySkillInvoked(player, "joyex__huangtian")
    target:broadcastSkillInvoke("joyex__huangtian")
    local targetRecorded = player:getTableMark( "joyex__huangtian_sources-phase")
    table.insertIfNeed(targetRecorded, target.id)
    room:setPlayerMark(player, "joyex__huangtian_sources-phase", targetRecorded)
    room:moveCardTo(effect.cards, Player.Hand, target, fk.ReasonGive, huangtian_other.name, nil, true)
  end,
})

return huangtian_other